package com.jianyun.jyzs.presenter;

import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
import com.jianyun.jyzs.bean.NewSign2Bean;
import com.jianyun.jyzs.bean.NewSignRecodeBean;
import com.jianyun.jyzs.model.NewSignRecordModel;
import com.jianyun.jyzs.model.imdoel.INewSignRecordModel;
import com.jianyun.jyzs.view.iview.INewSignRecordView;

import java.util.List;

/**
 * Created by yangshijun on 2018/6/13.
 */

public class NewSignRePresenter extends MvpBasePresenter<INewSignRecordView> {

    /**
     * 获取打卡记录
     *
     * @param enterpriseCode
     * @param userId
     * @param signDate
     */
    public void getSignData(String enterpriseCode, String userId, String signDate) {
        if (!isViewAttached()) return;
        getView().showLoading();
        NewSignRecordModel.getInstance().getRecordeByDate(enterpriseCode, userId, signDate, new INewSignRecordModel.OnGetRecordListener() {
            @Override
            public void onGetSuccess(List<NewSign2Bean.SignDetail> signDetail) {
                getView().hintLoading();

                getView().onSuccess(signDetail);
            }

            @Override
            public void onFailed(String msg) {
                getView().hintLoading();
                getView().onFailed(msg);
            }
        });
    }
}
